//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "Utils/Base/Core.h"

#include "Utils/Base/Meta.Common.h"

namespace Engine
{
namespace Utils
{


	//
	// Sound Converter
	//

	class SoundConverter
	{
	// types
	private:


	// variables
	private:
		Ptr< UtilsCore >	_core;


	// metadata
	public:
		struct MetaSoundList
		{
			string			inputDir;
			string			outputDir;
			string			extension;
			string_array_t	sounds;
		};

		static CMetaClass &		GetMetaClass ()		{ static CMetaClass metaClass;  return metaClass; }
		
		friend UX_CREATE_META_OBJECT( MetaSoundList,	GetMetaClass() );


		static void InitMetaData ()
		{
			CMetaClass::s_InitBaseTypes();

			CMetaAddIteratorPtr	iter;

			if ( not GetMetaClass().IsInit() )
			{
				MetaSoundList obj;

				GetMetaClass().CreateExt( "SoundList", obj );
				iter = GetMetaClass().GetAddIter( obj );

				iter->AddField( obj.inputDir,		"input_dir" );
				iter->AddField( obj.outputDir,		"output_dir" );
				iter->AddField( obj.extension,		"extension" );
				iter->AddField( obj.sounds,			"sounds" );
			}
		}


	// methods
	public:
		SoundConverter (UtilsCore *core) : _core(core)
		{
			InitMetaData();
		}

		~SoundConverter ();
		

		bool LoadConfig (uni_c_string filename, uni_c_string outputPath, bool clearOutputDir);

	private:
		bool _ConvertFont (uni_c_string inputFile, uni_c_string outputFile);
	};


}	// Utils
}	// Engine